package com.bloveoacom.http;


import com.bloveoacom.weichi.bean.ActivityDetailBean;
import com.bloveoacom.weichi.bean.ActivitysBean;
import com.bloveoacom.weichi.bean.Comment2Bean;
import com.bloveoacom.weichi.bean.CommentBean;
import com.bloveoacom.weichi.bean.FirBean;
import com.bloveoacom.weichi.bean.MyFansBean;
import com.bloveoacom.weichi.bean.NewsPostBean;
import com.bloveoacom.weichi.bean.PostCoinBean;
import com.bloveoacom.weichi.bean.PostDetailBean;
import com.bloveoacom.weichi.bean.RewardBean;
import com.bloveoacom.weichi.bean.UserBean;

import java.util.LinkedHashMap;
import java.util.List;

import io.reactivex.Flowable;
import okhttp3.RequestBody;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.PartMap;
import retrofit2.http.Query;

import static com.bloveoacom.http.HttpApi.TU_FINDUSERCOINLIST;
import static com.bloveoacom.http.HttpApi.TU_GETUSERKEY;
import static com.bloveoacom.http.HttpApi.TU_QUERYHOMEPAGEINFO;
import static com.bloveoacom.http.HttpApi.TU_QUERYREVIEWCOINNEW;
import static com.bloveoacom.http.HttpApi.TU_QUERYUSERCOLLECTLIST;
import static com.bloveoacom.http.HttpApi.TU_QUERYUSERVOTELIST;
import static com.bloveoacom.http.HttpApi.TU_REGISTERWALLET;
import static com.bloveoacom.http.HttpApi.TU_UPDATEUSER;
import static com.bloveoacom.http.HttpApi.TU_UPLOADIMGFORHEADER;
import static com.bloveoacom.http.HttpApi.TU_UPLOADIMGS;
import static com.bloveoacom.http.HttpApi.TU_USERSIGNIN;
import static com.bloveoacom.http.HttpApi.WC_GETCODE;
import static com.bloveoacom.http.HttpApi.WC_GETCOINNEWSLIST;
import static com.bloveoacom.http.HttpApi.WC_LOGIN;

/**
 * Created by yujunlong on 2016/11/11.
 */

public interface HttpService {

    @FormUrlEncoded
    @POST(WC_GETCODE)
    Flowable<HttpResult<String>> getCode(@Field("phone") String phone, @Field("type") int type);
    @FormUrlEncoded
    @POST(WC_LOGIN)
    Flowable<HttpResult<Object>> login(@Field("phone") String phone, @Field("code") String code);

    /**
     * 获取帖子列表
     *
     * @return
     */

    @FormUrlEncoded
    @POST(WC_GETCOINNEWSLIST)
    Flowable<PostCoinBean> getCoinNewsList(@Field("pageNum") int pageNum, @Field("pageSize") int pageSize, @Field("sort") String sort, @Field("title") String title);

    /**
     * 获取帖子详情
     *
     * @return
     */
    @FormUrlEncoded
    @POST(HttpApi.TU_GETCOINNEWSDETAIL)
    Flowable<HttpResult<PostDetailBean>> getCoinNewsDetail(@Field("token") String token, @Field("coinId") String coinId);

    /**
     * 获取评论列表
     *
     * @return
     */
    @FormUrlEncoded
    @POST(HttpApi.TU_GETCOMMENTLIST)
    Flowable<HttpResult<Comment2Bean>> getCommentList(@Field("pageNum") int pageNum, @Field("pageSize") int pageSize, @Field("coinId") String coinId);

    /**
     * 评论
     *
     * @return
     */
    @FormUrlEncoded
    @POST(HttpApi.TU_COMMENT)
    Flowable<HttpResult<RewardBean>> comment(
              @Field("coinId") String coinId,
              @Field("content") String content,
              @Field("token") String token ,
              @Field("replyUserId") String replyUserId ,
              @Field("type") String type ,
              @Field("replyCommentId") String replyCommentId ,
             @Field("sign") String sign);


    @Multipart
    @POST(TU_UPLOADIMGS)
    Flowable<HttpResult<List<String>>> uploadImgs(@PartMap LinkedHashMap<String, RequestBody> map);


    //关注
    @FormUrlEncoded
    @POST(HttpApi.TU_USERFOCUS)
    Flowable<HttpResult<Object>> userFocus(@Field("token") String token,@Field("targetUserId") String targetUserId,@Field("type") int type);
    //收藏
    @FormUrlEncoded
    @POST(HttpApi.TU_GOCOLLECTION)
    Flowable<HttpResult<Object>> goCollection(@Field("token") String token,@Field("coinId") String coinId,@Field("type") int type,@Field("isCollect") int isCollect);

    /**
     * 点赞
     *
     * @return
     */
    @GET(HttpApi.TU_COLLECT)
    Flowable<HttpResult<RewardBean>> collect(@Query("objectId") String objectId, @Query("type") int type, @Query("isCollected") int isCollected, @Query("token") String token);


    @GET(HttpApi.TU_GETCOMMENTALLLIST)
    Flowable<HttpResult<CommentBean>> getCommentAllList(@Query("token") String token,@Query("pageNum") int pageNum,@Query("pageSize") int pageSize,@Query("commentId") String commentId,@Query("sort") String sort);

    @FormUrlEncoded
    @POST(HttpApi.TU_RELEASETU)
    Flowable<HttpResult<RewardBean>> releasePost(@Field("emtNum") String emtNum, @Field("title") String title, @Field("content") String content, @Field("token") String token, @Field("sign") String sign);



    @FormUrlEncoded
    @POST(HttpApi.TU_GETUSERINFO)
    Flowable<HttpResult<UserBean>> getUserInfo(@Field("token") String token);


    @FormUrlEncoded
    @POST(TU_USERSIGNIN)
    Flowable<HttpResult<Object>> userSignIn(@Field("token") String token);

    @GET(HttpApi.FIR_LATEST)
    Flowable<FirBean> latest();

    @FormUrlEncoded
    @POST(TU_UPDATEUSER)
    Flowable<HttpResult<Object>> updateUser(@Field("token") String token, @Field("userName") String userName);
    @Multipart
    @POST(TU_UPLOADIMGFORHEADER)
    Flowable<HttpResult<RewardBean>> uploadImgForHeader(@PartMap LinkedHashMap<String, RequestBody> files);

    @FormUrlEncoded
    @POST(HttpApi.TU_QUERYUSERFOCUSLIST)
    Flowable<HttpResult<List<MyFansBean>>> queryUserFocusList(@Field("token") String token, @Field("targetUserId") String targetUserId, @Field("pageNum") int pageNum, @Field("pageSize") int pageSize);


    @FormUrlEncoded
    @POST(HttpApi.TU_QUERYUSERFANSLIST)
    Flowable<HttpResult<List<MyFansBean>>> queryUserFansList(@Field("token") String token,@Field("targetUserId") String targetUserId,@Field("pageNum") int pageNum,@Field("pageSize") int pageSize);


    @FormUrlEncoded
    @POST(TU_QUERYHOMEPAGEINFO)
    Flowable<HttpResult<Object>> queryHomePageInfo(@Field("token") String token,@Field("targetUserId") String targetUserId,@Field("pageNum") int pageNum,@Field("pageSize") int pageSize);

    @FormUrlEncoded
    @POST(TU_FINDUSERCOINLIST)
    Flowable<HttpResult<Object>> findUserCoinList(@Field("token") String token,@Field("type") String type,@Field("pageNum") int pageNum,@Field("pageSize") int pageSize);
    @FormUrlEncoded
    @POST(TU_QUERYREVIEWCOINNEW)
    Flowable<HttpResult<NewsPostBean>> queryReviewCoinNew(@Field("token") String token,@Field("coinId") String coinId);
    @FormUrlEncoded
    @POST(TU_QUERYUSERVOTELIST)
    Flowable<HttpResult<List<NewsPostBean>>> queryUserVoteList(@Field("token") String token, @Field("pageNum") int pageNum, @Field("pageSize") int pageSize);
    @FormUrlEncoded
    @POST(TU_QUERYUSERCOLLECTLIST)
    Flowable<HttpResult<List<NewsPostBean>>> queryUserCollectList(@Field("token") String token, @Field("pageNum") int pageNum, @Field("pageSize") int pageSize);
    @FormUrlEncoded
    @POST(TU_REGISTERWALLET)
    Flowable<HttpResult<Object>> registerWallet(@Field("token") String token,@Field("walletAccount") String walletAccount,@Field("sign") String sign);

    @FormUrlEncoded
    @POST(HttpApi.TU_FINDTIMESTAMP)
    Flowable<HttpResult<Object>> findTimeStamp(@Field("token") String token);

    @FormUrlEncoded
    @POST(TU_GETUSERKEY)
    Flowable<HttpResult<Object>> getUserKey(@Field("token") String token,@Field("sign") String sign);

      /** 获取活动列表
     *
             * @return
             */

    @FormUrlEncoded
    @POST(HttpApi.TU_GETACTIVITYLIST)
    Flowable<HttpResult<List<ActivitysBean>>> getActivityList(@Field("pageNum") int pageNum, @Field("pageSize") int pageSize, @Field("token") String token, @Field("title") String title);
    /**
     * 获取活动详情
     *
     * @return
     */

    @FormUrlEncoded
    @POST(HttpApi.TU_GETACTIVITYDETAIL)
    Flowable<HttpResult<ActivityDetailBean>> getActivityDetail(@Field("activityId") String activityId, @Field("token") String token);

    @FormUrlEncoded
    @POST(HttpApi.TU_GOREVIEWCOINNEW)
    Flowable<HttpResult<Object>> goReviewCoinNew(@Field("token") String token,@Field("coinId") String coinId,@Field("type") String type);
    @FormUrlEncoded
    @POST(HttpApi.TU_GETREVIEWCOINNEWSDETAIL)
    Flowable<HttpResult<Object>> getReviewCoinNewsDetail(@Field("token") String token,@Field("coinId") String coinId,@Field("sign") String sign);

    @FormUrlEncoded
    @POST(HttpApi.TU_GETTICKETRECORD)
    Flowable<HttpResult<List<ActivitysBean>>> getTicketRecord(@Field("token") String token,@Field("pageNum") int pageNum, @Field("pageSize") int pageSize);

    @FormUrlEncoded
    @POST(HttpApi.TU_GETTICKETRECORDDETAIL)
    Flowable<HttpResult<ActivitysBean>> getTicketRecordDetail(@Field("token") String token,@Field("orderId") int orderId);
    @FormUrlEncoded
    @POST(HttpApi.TU_EXCEPTIONAL)
    Flowable<HttpResult<Object>> exceptional(@Field("token") String token,
                                             @Field("activityId") String activityId,
                                             @Field("starId") String starId,
                                             @Field("sign") String sign,
                                             @Field("emtNum") int emtNum);
    @FormUrlEncoded
    @POST(HttpApi.TU_GETACTIVITYFARE)
    Flowable<HttpResult<List<ActivitysBean>>> getActivityFare(@Field("token") String token,
                                             @Field("activityId") String activityId);
    @FormUrlEncoded
    @POST(HttpApi.TU_BUYTICKET)
    Flowable<HttpResult<Object>> buyTicket(@Field("token") String token,
                                             @Field("activityId") String activityId,
                                             @Field("ticketNum") String ticketNum,
                                             @Field("ticketPrice") String ticketPrice,
                                             @Field("payType") String payType
                                           );
    @FormUrlEncoded
    @POST(HttpApi.TU_USERTRANSFER)
    Flowable<HttpResult<Object>> userTransfer(@Field("token") String token,@Field("sign") String sign,@Field("memo") String memo);



    @GET(HttpApi.TU_NOTTHROUGHCOINNEW)
    Flowable<HttpResult<Object>> notThroughCoinNew(@Query("coinId") String coinId, @Query("token") String token);

    @GET(HttpApi.TU_FENPEIEMT)
    Flowable<HttpResult<Object>> fenpeiEmt(@Query("coinId") String coinId, @Query("overType") String overType);


}
